/**
* 作者: chenlingzhi
* 日期: 2025-03-03 20:30:45
* 备注: 用户好友信息表
*/
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.Common;
import com.motu.monstercity.server.game.logic.BuddyManager;
import com.motu.vertx.module.utility.toolset.TimeUtils;
import com.motu.vertx.module.utility.toolset.Tool;

public class UserBuddy extends UserBuddyModel {
	public UserBuddy() {
		super();
	}

	public UserBuddy(long userId, long buddyId) {
		putUserId(userId);
		putBuddyId(buddyId);
	}

	public void reset() {
		if (!TimeUtils.isToday(getReceiveGiftTime())){
			// 隔日清空好友赠送的礼物
//			putGiftStatus(GameConstant.GIFT_STATUS_NULL);
			update();
		}
	}

	public Common.PBUserBuddy.Builder takeInitBuilder() {
		return takeBuilder();
	}

	public Common.PBUserBuddy.Builder takeBuilder() {
		Common.PBUserBuddy.Builder sb = Common.PBUserBuddy.newBuilder();
		sb.setGiftStatus(getGiftStatus());
		sb.setIsSendGift(TimeUtils.isToday(getGiftTime()));
		return BuddyManager.takeBuddyBuilder(sb,userId,buddyId);
	}

}
